/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

/* Login page styles */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.login-box {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 40px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.login-box h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 600;
}

.login-box .logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-box .logo i {
    font-size: 48px;
    color: #667eea;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 10px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-danger {
    background-color: #fee;
    color: #c33;
    border: 1px solid #fcc;
}

.alert-info {
    background-color: #e3f2fd;
    color: #1976d2;
    border: 1px solid #bbdefb;
}

.alert-success {
    background-color: #e8f5e8;
    color: #2e7d32;
    border: 1px solid #c8e6c9;
}

/* Fixed positioning for notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    margin-bottom: 10px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.notification.fade-out {
    animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Main app styles */
.app-container {
    min-height: 100vh;
    background: #f8f9fa;
}

.navbar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid #e1e5e9;
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    font-size: 24px;
    font-weight: 700;
    color: #667eea;
    text-decoration: none;
}

.navbar-menu {
    display: flex;
    align-items: center;
    gap: 20px;
}

.navbar-menu a {
    color: #666;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-menu a:hover {
    color: #667eea;
}

.search-box {
    display: flex;
    align-items: center;
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 25px;
    padding: 8px 16px;
    min-width: 300px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    flex: 1;
    padding: 4px 8px;
}

.search-box button {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
}

.main-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.upload-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.upload-area {
    border: 2px dashed #667eea;
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #f8f9ff;
}

.upload-area:hover {
    border-color: #764ba2;
    background: #f0f2ff;
}

.upload-area.dragover {
    border-color: #764ba2;
    background: #e8ebff;
}

.upload-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: #f8f9fa;
    transition: all 0.3s ease;
}

.upload-header:hover {
    border-color: #667eea;
    background: #f0f2ff;
}

.upload-header h2 {
    margin: 0;
    color: #333;
}

.upload-toggle {
    font-size: 12px;
    color: #667eea;
    transition: transform 0.3s ease;
    display: inline-block;
}

.upload-content {
    margin-top: 16px;
    transform-origin: top;
    will-change: transform, opacity;
}

.upload-icon {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 16px;
}

.upload-text {
    color: #666;
    font-size: 16px;
}

.file-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.file-item {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
    cursor: pointer;
}

.file-item:hover {
    transform: translateY(-5px);
}

.file-preview {
    width: 100%;
    height: 150px;
    object-fit: cover;
    background: #f8f9fa;
}

.file-icon {
    width: 100%;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    font-size: 48px;
    color: #667eea;
}

.file-info {
    padding: 15px;
}

.file-name {
    font-weight: 600;
    margin-bottom: 5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: #666;
    font-size: 12px;
}

.file-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.file-actions button {
    flex: 1;
    padding: 4px 8px;
    border: none;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 6px;
    cursor: pointer;
    font-size: 11px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 28px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    white-space: nowrap;
}

/* Simplified button styling */

.file-actions button:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.12);
}

.file-actions button:active {
    transform: translateY(0);
}

.file-actions .btn-share {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    color: #1976d2;
}

.file-actions .btn-share:hover {
    background: linear-gradient(135deg, #bbdefb 0%, #90caf9 100%);
}

.file-actions .btn-primary {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    color: #7b1fa2;
}

.file-actions .btn-primary:hover {
    background: linear-gradient(135deg, #e1bee7 0%, #ce93d8 100%);
}

.file-actions .btn-danger {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    color: #c62828;
}

.file-actions .btn-danger:hover {
    background: linear-gradient(135deg, #ffcdd2 0%, #ef9a9a 100%);
}

/* Clean, minimal button effects */

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-share {
    background: #28a745;
    color: white;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    margin: 50px auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.modal-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    color: #666;
}

.modal-close:hover {
    color: #333;
}

/* Image Modal Styles */
#imageModal .modal-content {
    background: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 95%;
    max-height: 95%;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative; /* 为二维码容器提供定位参考 */
}

#imageModal .modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: block;
    margin: 0 auto;
    z-index: 1001;
    position: relative;
}

#imageModal .modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

#imageModal .modal-close:hover {
    color: #ccc;
}

#imageModal #imageLoading,
#imageModal #imageError {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 1003;
    min-width: 120px;
    white-space: nowrap;
    font-size: 16px;
    font-weight: 500;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.8);
    line-height: 1.5;
    padding: 10px 15px;
    background: rgba(0, 0, 0, 0.6);
    border-radius: 8px;
    backdrop-filter: blur(4px);
}

/* 当加载中元素被隐藏时，确保不会遮挡图片 */
#imageModal #imageLoading[style*="display: none"],
#imageModal #imageError[style*="display: none"] {
    z-index: 0;
}

/* 专门为加载文本添加的样式，确保水平显示 */
#imageModal .image-loading-text {
    color: white !important;
    text-align: center !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    text-orientation: mixed !important;
    writing-mode: horizontal-tb !important;
}

.qr-container {
    text-align: center;
    padding: 20px;
}

.qr-container img {
    max-width: 200px;
    margin: 20px 0;
}

.share-info {
    background: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    margin: 15px 0;
}

.share-info p {
    margin: 5px 0;
    color: #666;
}

/* Settings page */
.settings-container {
    max-width: 600px;
    margin: 50px auto;
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.settings-container h1 {
    margin-bottom: 30px;
    color: #333;
}

.user-info {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 30px;
}

.user-info p {
    margin: 10px 0;
    color: #666;
}

/* Batch Operations Styles */
.batch-operations {
    background: white;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.batch-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
}

.batch-buttons {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* 统一的批量操作按钮样式 */
.btn-batch-mode,
.btn-monitoring,
.btn-batch-share,
.btn-batch-delete,
.btn-cancel {
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 100px;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.btn-batch-mode {
    background: #f0f2ff;
    color: #6366f1;
    border-color: #e0e7ff;
}

.btn-batch-mode:hover:not(:disabled) {
    background: #e0e7ff;
    border-color: #c7d2fe;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.2);
}

.btn-batch-share {
    background: #f0fdf4;
    color: #16a34a;
    border-color: #dcfce7;
}

.btn-batch-share:hover:not(:disabled) {
    background: #dcfce7;
    border-color: #bbf7d0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(22, 163, 74, 0.2);
}

.btn-batch-delete {
    background: #fef2f2;
    color: #dc2626;
    border-color: #fee2e2;
}

.btn-batch-delete:hover:not(:disabled) {
    background: #fee2e2;
    border-color: #fecaca;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.btn-cancel {
    background: #f8fafc;
    color: #64748b;
    border-color: #e2e8f0;
}

.btn-cancel:hover:not(:disabled) {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

/* 禁用状态样式 */
.btn-batch-share:disabled,
.btn-batch-delete:disabled,
.btn-cancel:disabled {
    background: #e9ecef;
    color: #6c757d;
    cursor: not-allowed;
    opacity: 0.6;
}

.batch-icon {
    font-size: 16px;
}


.batch-info {
    background: #f8f9fa;
    padding: 10px 15px;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

.file-checkbox-container {
    position: absolute;
    top: 8px;
    left: 8px;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.file-item {
    position: relative;
}

.file-item.batch-mode .file-checkbox-container {
    opacity: 1;
}

.file-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: #667eea;
}

.file-item.batch-mode {
    border: 2px solid #667eea;
    border-radius: 12px;
}

.file-item.batch-mode.selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.05);
}

.file-item.batch-mode .file-preview,
.file-item.batch-mode .file-icon {
    opacity: 0.8;
}

/* Responsive design */
@media (max-width: 768px) {
    .navbar-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-box {
        min-width: 100%;
    }
    
    .file-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .main-content {
        padding: 10px;
    }
    
    .batch-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .batch-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    
    .batch-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .file-operations-header {
        justify-content: center;
    }
}

/* 分页样式 */
.pagination-container {
    margin-top: 30px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid #e1e5e9;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

.pagination-btn:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-numbers {
    display: flex;
    gap: 5px;
}

.page-number {
    min-width: 36px;
    height: 36px;
    border: 1px solid #e1e5e9;
    background: white;
    color: #666;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.page-number:hover {
    background: #f8f9fa;
    border-color: #667eea;
    color: #667eea;
}

.page-number.active {
    background: #667eea;
    border-color: #667eea;
    color: white;
}

.pagination-info {
    text-align: center;
    color: #666;
    font-size: 12px;
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* 图片模态框二维码容器样式 */
#imageModal .modal-content {
    background: transparent;
    padding: 0;
    border-radius: 0;
    max-width: 95%;
    max-height: 95%;
    box-shadow: none;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    position: relative;
}

#imageModal .modal-image-container {
    position: relative;
    display: inline-block;
}

#imageModal .modal-image {
    max-width: 100%;
    max-height: 90vh;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    display: block;
    margin: 0 auto;
    z-index: 1001;
    position: relative;
}

#imageModal .modal-qr-container {
    position: absolute;
    bottom: 0;
    right: 20px;
    width: 180px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 1002;
}

#imageModal .modal-qr-code {
    width: 160px;
    height: 160px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
    background: white;
}

#imageModal .qr-loading {
    color: #666;
    font-size: 14px;
    text-align: center;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal .qr-error {
    color: #e74c3c;
    font-size: 12px;
    text-align: center;
    min-height: 160px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#imageModal .qr-info {
    text-align: center;
    color: #333;
}

#imageModal .qr-info p {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

#imageModal .qr-info .qr-expire {
    font-size: 12px;
    color: #666;
    font-weight: normal;
    margin-top: 5px;
}

#imageModal .modal-close {
    position: absolute;
    top: -40px;
    right: 0;
    color: white;
    font-size: 30px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

#imageModal .modal-close:hover {
    opacity: 0.7;
}

/* 响应式设计 - 移动端适配 */
@media (max-width: 768px) {
    #imageModal .modal-content {
        flex-direction: column;
        align-items: center;
        gap: 15px;
        position: relative; /* 添加相对定位，为二维码容器提供定位参考 */
    }
    
    #imageModal .modal-qr-container {
        position: absolute; /* 保持绝对定位以确保在右下角 */
        bottom: 20px;
        right: 20px;
        width: 160px;
        padding: 15px;
        z-index: 10;
    }
    
    #imageModal .modal-qr-code {
        width: 120px;
        height: 120px;
    }
    
    #imageModal .qr-loading,
    #imageModal .qr-error {
        min-height: 120px;
    }
    
    .pagination {
        flex-direction: column;
        gap: 15px;
    }
    
    .page-numbers {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 300px;
    }
    
    .pagination-info {
        flex-direction: column;
        gap: 5px;
    }
}

/* Live按钮样式 */
.btn-monitoring {
    background: #fef3c7;
    color: #d97706;
    border-color: #fde68a;
}
.btn-monitoring:hover:not(:disabled) {
    background: #fde68a;
    border-color: #fcd34d;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2);
}
.btn-monitoring.active {
    background: #f87171;
    color: white;
    border-color: #f87171;
}
.btn-monitoring.active:hover:not(:disabled) {
    background: #ef4444;
    border-color: #ef4444;
}